package com.tourismhengyang.actions;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.tourismhengyang.beans.WayInfo;
import com.tourismhengyang.biz.IWayInfoBiz;
import com.tourismhengyang.impl.WayInfoBizImpl;
import com.tourismhengyang.utils.JsonObject;

public class WayInfoAction extends ActionSupport implements ModelDriven<WayInfo>{

	private static final long serialVersionUID = 1L;
	private JsonObject json;
	private WayInfo wayInfo;
	private IWayInfoBiz wayInfoBiz=new WayInfoBizImpl();
	public String getWayInfoList(){
		List<WayInfo> list=wayInfoBiz.getWayInfoList();
		if(list!=null){
			json=new JsonObject();
			json.setRows(list);
			return SUCCESS;
		}
		return null;
	}
	
	public String addWayInfo(){
		int result=wayInfoBiz.addWayInfo(wayInfo);
		json=new JsonObject();
		json.setObj(result);
		return SUCCESS;
	}
	
	public JsonObject getJson() {
		return json;
	}

	@Override
	public WayInfo getModel() {
		if(wayInfo==null){
			wayInfo=new WayInfo();
		}
		return wayInfo;
	}
}
